<?php
/*=============================================================================
|| ##################################################################
||	phpFoX Konsort
|| ##################################################################
||	
||	Copyright		: (C) 2005-2007 PHPFOX Limited a Reality Fox Creation
||	Contact			: info@phpfox.com
||
||	- phpFoX and all of its source code and files are protected by Copyright Laws. 
||
||	- The license for phpFoX permits you to install this software on a single domain (.com, .org, .net, etc.). 
||
||	- You may also not remove this copyright screen which shows the copyright information and credits for phpFoX (RealityFOX Creations). 
||
||	- phpFoX Konsort is NOT a FREE software - http://www.phpfox.com/license/
||
|| ##################################################################
=============================================================================*/

/* $File: ./include/modules/Forum/classes/PhpFox_ComponentMarkAllRead.class.php, $Author:  $ */



/** Mark all topics as read compnent.
 * 
 * Parameters:
 * 1. oUser (optional) - current user (if omitted - try to get current user)
 * 
 * @package module.forum
 * @version $Id: PhpFox_ComponentMarkAllRead.class.php 46 2007-12-14 23:12:21Z phpfoxsv $
 *   
 */
class PhpFox_Mod_Forum_ComponentMarkAllRead extends BaseComponent
{

    /** Processing method
     */
	function process()
	{
        $oSrvSec = &App::getModuleService('Account', 'Security');
        /* @var $oSrvSec PhpFox_Mod_Account_ServiceSecurity */
        $oSrvSec->checkPerm('forum', 'full');
        	    
	    $oSrvForum = &$this->_oModule->getService('Forum');
	    /* @var $oSrvForum PhpFox_Mod_Forum_ServiceForum */
	    $oUser = $this->getParam('oUser');
	    if (!$oUser)
	    {
	        $oSrvSec = &App::getModuleService('Account', 'Security');
	        /* @var $oSrvSec PhpFox_Mod_Account_ServiceSecurity */
	        $oUser = &$oSrvSec->getCurrentUser();
	    }
	    
	    $oSrvForum->markAllTopicView($oUser);

		$oTpl = &$this->_oModule->getTemplate();
		$oTpl->assign(array(
            'aForumJumpList' => $oSrvForum->getForumHash(),
		));
		$srcHtml = $oTpl->fetch('MarkAllRead.html');
		return $srcHtml;
	}

}
?>